Part of the series

Several example codes

~1 min read • Updated Sep 16, 2025

Program Description

This program, written in Python, prompts the user to input the base and the height of a parallelogram.
It then calculates the area using the standard formula—multiplying the base by the height—and displays the result.

Python Code Example:


base = float(input("Please enter the base of the parallelogram: "))
height = float(input("Please enter the height of the parallelogram: "))
area = base * height
print("The area of the parallelogram is:", area)

Sample Output:


Please enter the base of the parallelogram: 6
Please enter the height of the parallelogram: 4
The area of the parallelogram is: 24.0

Code Explanation:

In this script:
- The input() function collects user input.
- The values are converted to decimals using float() to ensure accurate calculation.
- The formula base × height is applied using the * operator.
- The final result is displayed using the print() function.


Written & researched by Dr. Shahin Siami